/*
 * @Author: your name
 * @Date: 2020-03-25 13:16:29
 * @LastEditTime: 2020-03-25 13:30:46
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-imooc-ebook\src\router.js
 */
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  // 重定向 ，让路由指向idex.vue
  {
    path: '/login',
    component: () => import('./views/login/login.vue')
  },
  {
    path: '/register',
    component: () => import('./views/login/register.vue')
  },
  {
    path: '/ebook',
    component: () => import('./views/ebook/index.vue'),
    children: [
      {
        path: ':fileName',
        component: () => import('./components/ebook/EbookReader.vue')
      }
    ]
  },
  {
    path: '/store',
    component: () => import('./views/store/index.vue'),
    redirect: '/store/home',
    children: [
      {
        path: 'shelf',
        component: () => import('./views/store/StoreShelf.vue')
      },
      {
        path: 'category',
        component: () => import('./views/store/StoreCategory.vue')
      },
      {
        path: 'home',
        component: () => import('./views/store/StoreHome.vue')
      },
      {
        path: 'list',
        component: () => import('./views/store/StoreList.vue')
       },
       {
        path: 'detail',
        component: () => import('./views/store/StoreDetail.vue')
       },
       {
        path: 'speaking',
        component: () => import('./views/store/StoreSpeaking.vue')
       }
    ]
  },
  {
    path: '/selfInfo',
    component: () => import('./views/self/SelfInfo.vue')
  },
  {
    path: '/AlterSelfInfo',
    component: () => import('./views/self/AlterSelfInfo.vue')
  },
  {
    path: '/Statics',
    component: () => import('./views/self/Statics.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
